﻿using System;

namespace Listing2_85
{
    class _2_85
    {
        static WeakReference data;


        class Program
        {
            static void Main(string[] args)
            {


            }
        }

        public static void Run()
        {
            object result = GetData();
            // GC.Collect(); Uncommenting this line will make data.Target null
            result = GetData();
        }

        private static object GetData()
        {
            if (data == null)
            {
                data = new WeakReference(LoadLargeList());
            }
            if (data.Target == null)
            {
                data.Target = LoadLargeList();
            }
            return data.Target;
        }

        private static object LoadLargeList()
        {
            throw new NotImplementedException();
        }
    }
}
